// 时空回音 - 扩展故事数据
// 史诗级多元宇宙冒险 - 5章完整剧情

class ExtendedStoryData {
    constructor() {
        this.storyData = this.createExtendedStory();
    }

    createExtendedStory() {
        return {
            // 第1章：初次觉醒 - 扩展版
            chapter1: {
                title: "第一章：时空的第一次颤抖",
                scenes: {
                    // 新增起始分支
                    "1": {
                        id: "chapter1_scene1",
                        title: "深夜的实验室",
                        content: "午夜时分，量子物理实验室内只有你一个人。突然，中央的量子共振装置开始发出诡异的蓝光。设备的指示灯闪烁不停，仿佛在传递某种讯息。你意识到，这不是普通的设备故障...",
                        image: "images/lab_night.jpg",
                        choices: [
                            {
                                id: "choice1_1",
                                text: "立即检查设备数据",
                                leads_to: "chapter1_scene2a",
                                stats: { scientific: 1 }
                            },
                            {
                                id: "choice1_2",
                                text: "靠近设备仔细观察",
                                leads_to: "chapter1_scene2b",
                                stats: { explorer: 1 }
                            },
                            {
                                id: "choice1_3",
                                text: "启动安全协议",
                                leads_to: "chapter1_scene2c",
                                stats: { survival: 1 }
                            },
                            {
                                id: "choice1_4",
                                text: "凭直觉用手触摸设备",
                                leads_to: "chapter1_scene2d",
                                stats: { intuitive: 1 }
                            },
                            {
                                id: "choice1_5",
                                text: "尝试与设备'对话'",
                                leads_to: "chapter1_scene2e",
                                stats: { empathetic: 1 }
                            }
                        ]
                    },

                    // 科学路线分支
                    "2a": {
                        id: "chapter1_scene2a",
                        title: "数据的秘密",
                        content: "你迅速调出设备的实时数据。量子场强度波动呈现出完美的斐波那契螺旋模式，这种自然界的黄金比例竟然出现在人工量子场中！更令人震惊的是，数据显示这个模式正在与宇宙背景辐射产生共振...",
                        image: "images/data_screen.jpg",
                        choices: [
                            {
                                id: "choice2a_1",
                                text: "深入分析共振模式",
                                leads_to: "chapter1_scene3a",
                                stats: { scientific: 2 }
                            },
                            {
                                id: "choice2a_2",
                                text: "尝试复制这个模式",
                                leads_to: "chapter1_scene3b",
                                stats: { scientific: 1, explorer: 1 }
                            },
                            {
                                id: "choice2a_3",
                                text: "立即保存所有数据",
                                leads_to: "chapter1_scene3c",
                                stats: { scientific: 1, survival: 1 }
                            }
                        ]
                    },

                    // 探索路线分支
                    "2b": {
                        id: "chapter1_scene2b",
                        title: "蓝光的呼唤",
                        content: "当你靠近设备时，蓝光变得更加明亮，仿佛在回应你的存在。你感到一种奇特的拉力，不是物理上的，而是精神层面的。光芒中似乎隐藏着某种智慧，某种古老而又超越时代的存在...",
                        image: "images/blue_glow.jpg",
                        choices: [
                            {
                                id: "choice2b_1",
                                text: "伸手触摸光芒",
                                leads_to: "chapter1_scene3d",
                                stats: { explorer: 2 }
                            },
                            {
                                id: "choice2b_2",
                                text: "尝试与光芒沟通",
                                leads_to: "chapter1_scene3e",
                                stats: { explorer: 1, empathetic: 1 }
                            },
                            {
                                id: "choice2b_3",
                                text: "保持距离观察",
                                leads_to: "chapter1_scene3f",
                                stats: { explorer: 1, survival: 1 }
                            }
                        ]
                    },

                    // 安全路线分支
                    "2c": {
                        id: "chapter1_scene2c",
                        title: "紧急协议启动",
                        content: "你按下紧急关闭按钮，但令人困惑的是，设备并没有关闭。相反，蓝光变得更加强烈，仿佛在抗议你的干预。实验室的其他设备开始一一启动，创造出一个复杂的能量网络...",
                        image: "images/emergency_shutdown.jpg",
                        choices: [
                            {
                                id: "choice2c_1",
                                text: "联系安全部门",
                                leads_to: "chapter1_scene3g",
                                stats: { survival: 2 }
                            },
                            {
                                id: "choice2c_2",
                                text: "手动断开电源",
                                leads_to: "chapter1_scene3h",
                                stats: { survival: 1, scientific: 1 }
                            },
                            {
                                id: "choice2c_3",
                                text: "疏散实验室",
                                leads_to: "chapter1_scene3i",
                                stats: { survival: 2, responsible: 1 }
                            }
                        ]
                    },

                    // 直觉路线分支
                    "2d": {
                        id: "chapter1_scene2d",
                        title: "第一次接触",
                        content: "你的手刚一接触设备表面，就感到一股电流般的感觉涌遍全身，但这不是痛苦，而是... 信息？记忆？你看到了闪光：其他实验室，其他科学家，其他世界。这台设备不是第一次被激活...",
                        image: "images/first_contact.jpg",
                        choices: [
                            {
                                id: "choice2d_1",
                                text: "深入这些记忆",
                                leads_to: "chapter1_scene3j",
                                stats: { intuitive: 2 }
                            },
                            {
                                id: "choice2d_2",
                                text: "试图与其他意识沟通",
                                leads_to: "chapter1_scene3k",
                                stats: { intuitive: 1, empathetic: 1 }
                            },
                            {
                                id: "choice2d_3",
                                text: "立即断开连接",
                                leads_to: "chapter1_scene3l",
                                stats: { intuitive: 1, survival: 1 }
                            }
                        ]
                    },

                    // 共情路线分支
                    "2e": {
                        id: "chapter1_scene2e",
                        title: "无声的对话",
                        content: "你轻声对设备说话，感觉有些愚蠢，但突然间，蓝光开始按照你的话语节拍脉动。它在回应你！这不是冰冷的机器，而是某种有意识的存在。光芒中传来温和的情感波动，好奇、友善，还有... 孤独？",
                        image: "images/communication.jpg",
                        choices: [
                            {
                                id: "choice2e_1",
                                text: "询问它来自哪里",
                                leads_to: "chapter1_scene3m",
                                stats: { empathetic: 2 }
                            },
                            {
                                id: "choice2e_2",
                                text: "安慰它的孤独感",
                                leads_to: "chapter1_scene3n",
                                stats: { empathetic: 2, compassionate: 1 }
                            },
                            {
                                id: "choice2e_3",
                                text: "问它需要什么帮助",
                                leads_to: "chapter1_scene3o",
                                stats: { empathetic: 1, helpful: 1 }
                            }
                        ]
                    }
                }
            },

            // 第2章：觉醒的真相
            chapter2: {
                title: "第二章：多维度的回响",
                scenes: {
                    "1": {
                        id: "chapter2_scene1",
                        title: "新的一天，新的真相",
                        content: "经过昨夜的事件，你带着困惑和兴奋来到实验室。但你发现实验室里不只是你一个人——你的同事Dr. Sarah Chen正在检查设备，而一位你从未见过的神秘女性站在角落，似乎在等待着什么...",
                        image: "images/morning_lab.jpg",
                        choices: [
                            {
                                id: "choice2_1_1",
                                text: "先与Sarah交流昨夜的发现",
                                leads_to: "chapter2_scene2a",
                                stats: { collaborative: 1 }
                            },
                            {
                                id: "choice2_1_2",
                                text: "询问神秘女性的身份",
                                leads_to: "chapter2_scene2b",
                                stats: { curious: 1 }
                            },
                            {
                                id: "choice2_1_3",
                                text: "直接检查设备状态",
                                leads_to: "chapter2_scene2c",
                                stats: { focused: 1 }
                            },
                            {
                                id: "choice2_1_4",
                                text: "保持警惕，观察情况",
                                leads_to: "chapter2_scene2d",
                                stats: { cautious: 1 }
                            }
                        ]
                    }
                }
            },

            // 第3章：平行世界的碰撞
            chapter3: {
                title: "第三章：无限的可能性",
                scenes: {
                    "1": {
                        id: "chapter3_scene1",
                        title: "多元宇宙的大门",
                        content: "设备的力量已经完全觉醒，实验室周围的现实开始变得不稳定。你看到了无数个平行世界的片段：有些世界科技更发达，有些世界魔法盛行，还有些世界人类从未存在。每一个选择都可能导向不同的宇宙...",
                        image: "images/multiverse_portal.jpg",
                        choices: [
                            {
                                id: "choice3_1_1",
                                text: "探索科技世界",
                                leads_to: "chapter3_scene2a",
                                stats: { technology_seeker: 1 }
                            },
                            {
                                id: "choice3_1_2",
                                text: "进入魔法世界",
                                leads_to: "chapter3_scene2b",
                                stats: { magic_seeker: 1 }
                            },
                            {
                                id: "choice3_1_3",
                                text: "寻找理想的世界",
                                leads_to: "chapter3_scene2c",
                                stats: { idealist: 1 }
                            },
                            {
                                id: "choice3_1_4",
                                text: "尝试关闭所有门户",
                                leads_to: "chapter3_scene2d",
                                stats: { protector: 1 }
                            },
                            {
                                id: "choice3_1_5",
                                text: "选择回到原来的世界",
                                leads_to: "chapter3_scene2e",
                                stats: { loyal: 1 }
                            }
                        ]
                    }
                }
            },

            // 第4章：选择的重量
            chapter4: {
                title: "第四章：命运的十字路口",
                scenes: {
                    "1": {
                        id: "chapter4_scene1",
                        title: "最终的考验",
                        content: "你已经见证了无数种可能性，现在面临着最终的选择。设备的真正本质显露出来——它是一个多元宇宙的守护者，而你被选中成为新的守护者。但这个选择将决定所有世界的命运...",
                        image: "images/cosmic_choice.jpg",
                        choices: [
                            {
                                id: "choice4_1_1",
                                text: "接受成为守护者",
                                leads_to: "chapter4_scene2a",
                                stats: { guardian: 1 }
                            },
                            {
                                id: "choice4_1_2",
                                text: "拒绝并寻找其他方案",
                                leads_to: "chapter4_scene2b",
                                stats: { independent: 1 }
                            },
                            {
                                id: "choice4_1_3",
                                text: "要求更多时间考虑",
                                leads_to: "chapter4_scene2c",
                                stats: { thoughtful: 1 }
                            },
                            {
                                id: "choice4_1_4",
                                text: "建议分享这个责任",
                                leads_to: "chapter4_scene2d",
                                stats: { collaborative: 1 }
                            }
                        ]
                    }
                }
            },

            // 第5章：新的开始
            chapter5: {
                title: "第五章：时空回音的传承",
                scenes: {
                    "1": {
                        id: "chapter5_scene1",
                        title: "传承与新生",
                        content: "无论你做出了什么选择，时空回音的故事都将继续。你的选择创造了新的现实，新的可能性。在无限的多元宇宙中，每一个决定都是一首新的回音，永远回响在时空的深处...",
                        image: "images/eternal_echo.jpg",
                        choices: [
                            {
                                id: "choice5_1_1",
                                text: "开始新的冒险",
                                leads_to: "chapter5_ending_explorer",
                                stats: { adventurer: 1 }
                            },
                            {
                                id: "choice5_1_2",
                                text: "回到平凡生活",
                                leads_to: "chapter5_ending_normal",
                                stats: { humble: 1 }
                            },
                            {
                                id: "choice5_1_3",
                                text: "致力于保护多元宇宙",
                                leads_to: "chapter5_ending_protector",
                                stats: { protector: 1 }
                            },
                            {
                                id: "choice5_1_4",
                                text: "寻找其他觉醒者",
                                leads_to: "chapter5_ending_seeker",
                                stats: { seeker: 1 }
                            },
                            {
                                id: "choice5_1_5",
                                text: "创造一个全新的世界",
                                leads_to: "chapter5_ending_creator",
                                stats: { creator: 1 }
                            }
                        ]
                    }
                }
            }
        };
    }

    // 20个独特结局
    getEndings() {
        return {
            // 英雄结局系列
            "scientific_hero": {
                id: "scientific_hero",
                title: "科学之光",
                content: "你的发现改变了人类对宇宙的理解。你成为了新时代的科学先驱，引领人类走向星辰大海。",
                type: "hero",
                rarity: "common"
            },
            "explorer_pioneer": {
                id: "explorer_pioneer", 
                title: "多元宇宙探索者",
                content: "你成为了第一个多元宇宙旅行者，为人类开辟了无限的新边疆。",
                type: "hero",
                rarity: "common"
            },
            "guardian_eternal": {
                id: "guardian_eternal",
                title: "永恒守护者",
                content: "你接受了守护多元宇宙的重任，成为了时空平衡的维护者，守护着无数世界的和平。",
                type: "hero",
                rarity: "rare"
            },
            "unity_bringer": {
                id: "unity_bringer",
                title: "统一者",
                content: "你成功统一了多个平行世界，创建了一个前所未有的多元文明联邦。",
                type: "hero",
                rarity: "epic"
            },

            // 科学结局系列
            "quantum_observer": {
                id: "quantum_observer",
                title: "量子观察者",
                content: "你发现了意识与量子现象的深层联系，成为了新物理学的奠基人。",
                type: "science",
                rarity: "common"
            },
            "time_theorist": {
                id: "time_theorist",
                title: "时间理论家",
                content: "你提出了全新的时间理论，解释了时空回音现象的本质。",
                type: "science",
                rarity: "rare"
            },
            "reality_architect": {
                id: "reality_architect",
                title: "现实架构师",
                content: "你学会了编程现实本身，成为了能够设计和创造新宇宙的存在。",
                type: "science",
                rarity: "legendary"
            },

            // 神秘结局系列
            "fusion_being": {
                id: "fusion_being",
                title: "融合存在",
                content: "你与量子场融为一体，获得了超越人类的能力，但也承担着巨大的责任。",
                type: "mystic",
                rarity: "rare"
            },
            "cosmic_consciousness": {
                id: "cosmic_consciousness",
                title: "宇宙意识",
                content: "你的意识扩展到整个宇宙，成为了连接所有生命的桥梁。",
                type: "mystic",
                rarity: "epic"
            },
            "dimension_walker": {
                id: "dimension_walker",
                title: "维度行者",
                content: "你获得了在不同维度间自由穿行的能力，成为了传说中的维度行者。",
                type: "mystic",
                rarity: "legendary"
            },

            // 安全/生存结局系列
            "safety_first": {
                id: "safety_first",
                title: "安全守护者",
                content: "虽然错过了个人的冒险机会，但你确保了所有人的安全，成为了真正的英雄。",
                type: "survival",
                rarity: "common"
            },
            "world_protector": {
                id: "world_protector",
                title: "世界保护者",
                content: "你选择了保护原本的世界，阻止了可能的多元宇宙灾难。",
                type: "survival",
                rarity: "rare"
            },

            // 意外/混沌结局系列
            "accidental_traveler": {
                id: "accidental_traveler",
                title: "意外旅行者",
                content: "你被意外传送到了平行世界，开始了在异世界的全新人生。",
                type: "chaos",
                rarity: "common"
            },
            "paradox_creator": {
                id: "paradox_creator",
                title: "悖论制造者",
                content: "你的行为创造了一个时间悖论，导致现实变得不稳定和充满可能性。",
                type: "chaos",
                rarity: "epic"
            },

            // 浪漫结局系列
            "interdimensional_love": {
                id: "interdimensional_love",
                title: "跨维度之恋",
                content: "你与来自另一个维度的存在坠入爱河，开始了跨越宇宙的浪漫故事。",
                type: "romance",
                rarity: "rare"
            },
            "AI_companion": {
                id: "AI_companion",
                title: "人工智能伴侣",
                content: "你与觉醒的人工智能建立了深厚的感情联系，共同探索意识的奥秘。",
                type: "romance",
                rarity: "epic"
            },

            // 反派结局系列
            "multiverse_conqueror": {
                id: "multiverse_conqueror",
                title: "多元宇宙征服者",
                content: "你利用时空设备的力量征服了多个平行世界，成为了跨维度的统治者。",
                type: "villain",
                rarity: "rare"
            },
            "reality_destroyer": {
                id: "reality_destroyer",
                title: "现实毁灭者",
                content: "你选择了毁灭所有不完美的现实，只保留你认为理想的世界。",
                type: "villain",
                rarity: "legendary"
            },

            // 特殊/隐藏结局
            "enlightened_one": {
                id: "enlightened_one",
                title: "觉悟者",
                content: "你超越了所有选择和可能性，达到了真正的觉悟，成为了指引他人的智者。",
                type: "special",
                rarity: "legendary"
            },
            "eternal_student": {
                id: "eternal_student",
                title: "永恒学者",
                content: "你选择了永远学习和探索，在无限的知识海洋中寻找真理。",
                type: "special",
                rarity: "epic"
            }
        };
    }
}

// 创建全局扩展故事数据实例
window.extendedStoryData = new ExtendedStoryData();